import { Component, OnInit } from '@angular/core';
import { HttpClient, HttpHeaders } from '@angular/common/http';

@Component({
  selector: 'app-tab4',
  templateUrl: './tab4.page.html',
  styleUrls: ['./tab4.page.scss'],
})
export class Tab4Page implements OnInit {
  uname = ''
  upwd = ''

  doLogin(){
    const url = '/xuezi/data/user/login.php';

    const body = `uname=${this.uname}&upwd=${this.upwd}`;

    this.http.post(url,body,{
      headers: new HttpHeaders({
        'content-type':'application/x-www-form-urlencoded',
      }),
      // 佩戴证书，需要提前配置跨越
      withCredentials:true
    }).subscribe((res)=>{
      console.log(res);
    });
  }

  constructor(public http: HttpClient) { }

  ngOnInit() {
  }

}
